<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>层次选择器</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: #FF0000;
        }
        /*1.后代选择器*/
      /*  div .message {
            color: white;
        }*/

        /*2.子元素选择器*/
        .box > .message {
            color: white;
        }

        /*3.相邻兄弟选择器*/
        h1+h1{
             color: green;
        }
    </style>
</head>
<body>

<div class="box">
    <div class="message">hello</div>
</div>
<div class="box">
    <div>
        <div class="message">
            world
        </div>
    </div>
</div>

<h1>标题1</h1>

<h1>标题2</h1>

<h1>标题3</h1>
</body>
</html>